<html>
<head>
	<?php /* 
                  .__                        .__                       .__.__                                         
_____        ____ |__| ____   ____    ______ |__|____    ____  ____    |__|  |      ____ _____  ____________________  
\__  \      / ___\|  |/    \ /  _ \   \____ \|  \__  \ _/ ___\/ __ \   |  |  |    _/ ___\\__  \ \___   /\___   /  _ \ 
 / __ \_   / /_/  >  |   |  (  <_> )  |  |_> >  |/ __ \\  \__\  ___/   |  |  |__  \  \___ / __ \_/    /  /    (  <_> )
(____  /   \___  /|__|___|  /\____/   |   __/|__(____  /\___  >___  >  |__|____/   \___  >____  /_____ \/_____ \____/ 
     \/   /_____/         \/          |__|           \/     \/    \/                   \/     \/      \/      \/     
	 
	 */?>
</head>
<body>
<h1 id="total"></h1>
<div style="width:200px;float:left">
	<ol id="done"></ol>
<h1><?php

	$c=mysql_connect("localhost","root","root");

	mysql_select_db("wininternet",$c);

	$result = mysql_query("SELECT ip FROM proxy_list");

	while($row = mysql_fetch_array($result))
	{
		$proxy_list[] = $row;
	}

	echo count($proxy_list);
?></h1>
</div>
<div style="width:350px;float:left">
<ol id="ok"></ol>
</div>
<div style="width:350px;float:left">
<ol id="ko"></ol>
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script>
var total=0;
var good=0;
var bad=0;
<?php
	foreach($proxy_list as $proxy){
?>
		$.get('async_internet.php?ip=<?php echo $proxy["ip"]?>', function(data) {
			$("#done").append("<li>Proxy id done</li>" );
			if(data.substr(0, 2)=="OK"){
				good++;
				$("#ok").append("<li style='background:green'><a href='http://"+data.replace("OK ","")+"'>"+data+"</a></li>");
			}else{
				bad++;
				$("#ko").append("<li style='background:red'><a href='http://"+data.replace("KO ","")+"'>"+data+"</a></li>");
			}
			total++;
			$('#total').html('Eseguiti '+total+' su <?php echo count($proxy_list)?><br />'+
					'Ne rimangono ' + (<?php echo count($proxy_list)?>-total) +'<br />'+
					'Andati a buon fine '+good+'<br />'+
					'Gi&agrave; fatti o non funzionanti '+bad);
		});
<?php
	}
?>
</script>
</body>
</html>
